package com.sdk.pay.transfer.api.params;

import org.json.JSONException;
import org.json.JSONObject;

import okhttp3.RequestBody;

/**
 * Created by Administrator on 2017/5/4.
 */

public abstract class Params {
    public final JSONObject mObject = new JSONObject();

    public abstract String toString();

    /**
     *put mObject
     * @param key
     * @param value
     * @throws JSONException
     */
    public void put(String key, Object value) throws JSONException{
        mObject.put(key, value);
    }
    /**
     *put mArray
     * @param value
     * @throws JSONException
     */
    public void put(Object value) throws JSONException{
        mObject.put("",value);
    }
    /**
     * put int
     *
     * @param key
     * @param value
     * @throws JSONException
     */
    public void put(String key, int value) throws JSONException{
        mObject.put(key, value);
    }

    /**
     * put boolean
     *
     * @param key
     * @param value
     * @throws JSONException
     */
    public void put(String key, boolean value) throws JSONException{
        mObject.put(key, value);
    }

    /**
     * put long
     *
     * @param key
     * @param value
     * @throws JSONException
     */
    public void put(String key, long value) throws JSONException{
        mObject.put(key, value);
    }

    /**
     * put double
     *
     * @param key
     * @param value
     * @throws JSONException
     */
    public void put(String key, double value) throws JSONException{
        mObject.put(key, value);
    }

    /**
     * post method must overWrite
     *
     * @return
     */
    public abstract RequestBody getRequestBody();
    /**
     * post method must overWrite
     *
     * @return
     */
    public abstract RequestBody getRequestBodyNoEncryption();
}
